#include "FOC.h"
#include "stm32f1xx_hal_i2c.h"
extern I2C_HandleTypeDef hi2c1;
extern FOC_TypeDef FOC_1;
extern FOC_TypeDef FOC_2;

void AS5600_Read(FOC_TypeDef* motor,I2C_HandleTypeDef* i2c)
{
	uint8_t IIC_Buffer[2]={0};
    HAL_I2C_Mem_Read(i2c,0x6C,0x0C,I2C_MEMADD_SIZE_8BIT,IIC_Buffer,2,50);
	
	motor->motor_angle=IIC_Buffer[0]<<8;
	motor->motor_angle=FOC_1.motor_angle|IIC_Buffer[1];
	motor->motor_angle*=0.08789;
}